#ifndef __MSG_H__
#define __MSG_H__

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#define DEFAULT_MSGQ_LEN        4

typedef struct _MSG_Stru_
{
    uint32_t    MsgId;
    uint32_t    MsgWParam;
}MSG, *P_MSG;

typedef struct _MSG_QUEUW_Stru_
{
    uint32_t    MaxMsgCount;
    uint32_t    ReadMsgIndex;
    uint32_t    WriteMsgIndex;
    P_MSG       pMsg;
}MSG_Q, *P_MSG_Q;

typedef enum _MSG_ID_
{
    DIB542_MSG_NULL,
    DIB542_MSG_TICK,
    DIB542_MSG_IRQ,
    DIB542_MSG_CAN,
    DIB542_MSG_Butt
}MSG_ID;

void DIB542_MsgInit(void);
int  DIB542_MsgPost(MSG_ID msgId, uint32_t wParam);
int  DIB542_MsgGet(int* pMsgId, uint32_t* pWParam);

#ifdef __cplusplus
}
#endif

#endif
